From: Andrew Cooper Date: Thu, 30 Jun 2016 20:00:01 +0000 (+0100) Subject: x86/VT-x: Dump VMCS on VMLAUNCH/VMRESUME failure X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~837 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=d0fd9ae54491328b10dee4003656c14b3bf3d3e9;p=xen.git x86/VT-x: Dump VMCS on VMLAUNCH/VMRESUME failure If a VMLAUNCH/VMRESUME fails due to invalid control or host state, dump the VMCS before crashing the domain. Signed-off-by: Andrew Cooper Acked-by: Kevin Tian Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 46b63b60f6..1bd875ad08 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -1637,6 +1637,11 @@ void vmx_vmentry_failure(void) __vmread(VM_INSTRUCTION_ERROR, &error); gprintk(XENLOG_ERR, "VM%s error: %#lx\n", curr->arch.hvm_vmx.launched ? "RESUME" : "LAUNCH", error); + + if ( error == VMX_INSN_INVALID_CONTROL_STATE || + error == VMX_INSN_INVALID_HOST_STATE ) + vmcs_dump_vcpu(curr); + domain_crash_synchronous(); } diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h index 9f1729d6ef..1e33d9c195 100644 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -567,6 +567,10 @@ enum vmcs_field { #define VMX_GUEST_MSR 0 #define VMX_HOST_MSR 1 +/* VM Instruction error numbers. */ +#define VMX_INSN_INVALID_CONTROL_STATE 7 +#define VMX_INSN_INVALID_HOST_STATE 8 + void vmx_disable_intercept_for_msr(struct vcpu *v, u32 msr, int type); void vmx_enable_intercept_for_msr(struct vcpu *v, u32 msr, int type); int vmx_read_guest_msr(u32 msr, u64 *val);